package edu.taru.dao;

import java.util.HashMap;
import java.util.List;

import edu.taru.pojo.User;
import util.SqlHelper;

public class LoginDaoImpl {
	
	
	/**
	 * 查询
	 * @param name
	 * @param password
	 * @return
	 */
	public User select(String username,String password) {
		User user =null;
		String sql = "select * from user where username =? and password=?";
		List<HashMap<String,Object>> list = SqlHelper.select1(sql,username,password);
		if(list!=null&&list.size()>0) {
			HashMap<String,Object> map = list.get(0);
			user = new User();
			user.setUsername(map.get("username")==null?null:map.get("username").toString());
			user.setPassword(map.get("password")==null?null:map.get("password").toString());
			
			
		}
		return user;
	}
}
